<form class="layui-form hisi-form" action="{:url()}" method="post">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>{$data['title']}配置</legend>
        </fieldset>
        {volist name="data['config']" id="v"}
            {switch name="v['type']"}
                {case value="textarea"}
                    <!--多行文本-->
                    <div class="layui-form-item">
                        <label class="layui-form-label">{$v['title']}</label>
                        <div class="layui-input-inline">
                            <textarea rows="6"  class="layui-textarea" name="{$key}" {if condition="isset($v['verify'])"}lay-verify="{$v['verify']}"{/if} autocomplete="off" placeholder="请填写{$v['title']}">{$v['value']}</textarea>
                        </div>
                        <div class="layui-form-mid layui-word-aux">{$v['tips']|raw}</div>
                    </div>
                {/case}
                {case value="array"}
                    <!--文本域-->
                    <div class="layui-form-item">
                        <label class="layui-form-label">{$v['title']}</label>
                        <div class="layui-input-inline">
                            <textarea rows="6" class="layui-textarea" name="{$key}" {if condition="isset($v['verify'])"}lay-verify="{$v['verify']}"{/if} autocomplete="off" placeholder="请填写{$v['title']}">{$v['value']}</textarea>
                        </div>
                        <div class="layui-form-mid layui-word-aux">{$v['tips']|raw}</div>
                    </div>
                {/case}
                {case value="switch"}
                    <!--开关-->
                    <div class="layui-form-item">
                        <label class="layui-form-label">{$v['title']}</label>
                        <div class="layui-input-inline">
                            <input type="checkbox" name="{$key}" value="1" lay-skin="switch" lay-text="{$v['options'][1]}|{$v['options'][0]}" {if condition="$v['value'] eq 1"}checked=""{/if}>
                        </div>
                        <div class="layui-form-mid layui-word-aux">{$v['tips']|raw}</div>
                    </div>
                {/case}
                {case value="select"}
                    <!--下拉框-->
                    <div class="layui-form-item">
                        <label class="layui-form-label">{$v['title']}</label>
                        <div class="layui-input-inline">
                            <select name="{$key}" {if condition="isset($v['verify'])"}lay-verify="{$v['verify']}"{/if}>
                                {volist name="v['options']" id="vv"}
                                    <option value="{$key}" {if condition="$key eq $v['value']"}selected{/if}>{$vv}</option>
                                {/volist}
                            </select>
                        </div>
                        <div class="layui-form-mid layui-word-aux">{$v['tips']|raw}</div>
                    </div>
                {/case}
                {case value="radio"}
                    <!--单选-->
                    <div class="layui-form-item">
                        <label class="layui-form-label">{$v['title']}</label>
                        <div class="layui-input-inline">
                            {foreach name="v['options']" id="vv" key="kk"}
                                <input type="radio" name="{$key}" value="{$kk}" title="{$vv}" {if condition="$kk eq $v['value']"}checked{/if}>
                            {/foreach}
                        </div>
                        <div class="layui-form-mid layui-word-aux">{$v['tips']|raw}</div>
                    </div>
                {/case}
                {case value="checkbox"}
                    <!--多选-->
                    <div class="layui-form-item">
                        <label class="layui-form-label">{$v['title']}</label>
                        <div class="layui-input-inline">
                            {foreach name="v['options']" id="vv" key="kk"}
                                <input type="checkbox" name="{$key}[]" value="{$kk}" title="{$vv}" lay-skin="primary" {if condition="in_array($kk, $v['value'])"}checked{/if}>
                            {/foreach}
                        </div>
                        <div class="layui-form-mid layui-word-aux">{$v['tips']|raw}</div>
                    </div>
                {/case}
                {case value="date"}
                    <!--日期-->
                    <div class="layui-form-item">
                        <label class="layui-form-label">{$v['title']}</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="{$key}" {if condition="isset($v['verify'])"}lay-verify="{$v['verify']}"{/if} value="{$v['value']}" autocomplete="off" placeholder="请填写{$v['title']}" onclick="layui.laydate({elem: this,format:'YYYY-MM-DD'})">
                        </div>
                        <div class="layui-form-mid layui-word-aux">{$v['tips']|raw}</div>
                    </div>
                {/case}
                {case value="datetime"}
                    <!--日期+时间-->
                    <div class="layui-form-item">
                        <label class="layui-form-label">{$v['title']}</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="{$key}" {if condition="isset($v['verify'])"}lay-verify="{$v['verify']}"{/if} value="{$v['value']}" autocomplete="off" placeholder="请填写{$v['title']}" onclick="layui.laydate({elem: this,format:'YYYY-MM-DD hh:mm:ss'})">
                        </div>
                        <div class="layui-form-mid layui-word-aux">{$v['tips']|raw}</div>
                    </div>
                {/case}
                {case value="image"}
                    <!--图片-->
                    <div class="layui-form-item">
                        <label class="layui-form-label">{$v['title']}</label>
                        <div class="layui-input-inline upload">
                            <button type="button" name="upload" class="layui-btn layui-btn-primary layui-upload" lay-type="image" lay-data="{ {if condition="!empty($v['url'])"}url: '{:url($v['url'])}', {/if}exts:'{:str_replace(',', '|', config('upload.upload_image_ext'))}', accept:'image'}">请上传{$v['title']}</button>
                            <input type="hidden" class="upload-input" {if condition="isset($v['verify'])"}lay-verify="{$v['verify']}"{/if} name="{$key}" value="{$v['value']}">
                            {if condition="$v['value']"}
                                <img src="{$v['value']}" style="display:inline-block;border-radius:5px;border:1px solid #ccc" width="36" height="36">
                            {else /}
                                <img src="" style="display:none;border-radius:5px;border:1px solid #ccc" width="36" height="36">
                            {/if}
                        </div>
                        <div class="layui-form-mid layui-word-aux">{$v['tips']|raw}</div>
                    </div>
                {/case}
                {case value="file"}
                    <!--文件-->
                    <div class="layui-form-item">
                        <label class="layui-form-label">{$v['title']}</label>
                        <div class="layui-input-inline upload">
                            <button type="button" name="upload" class="layui-btn layui-btn-primary layui-upload" lay-data="{ url: '{:url("upload")}', exts:'cer|pem|p12|pfx|txt', accept:'file'}">请上传{$v['title']}</button>
                            <input type="hidden" class="upload-input" {if condition="isset($v['verify'])"}lay-verify="{$v['verify']}"{/if} name="{$key}" value="{$v['value']}">
                        </div>
                        <div class="layui-form-mid layui-word-aux">{$v['tips']|raw}</div>
                    </div>
                {/case}
                {case value="hidden"}
                    <input type="hidden" name="{$key}" value="{$v['value']}">
                {/case}
                {default /}
                    <!--单行文本-->
                    <div class="layui-form-item">
                        <label class="layui-form-label">{$v['title']}</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="{$key}" value="{$v['value']}" autocomplete="off" {if condition="isset($v['verify'])"}lay-verify="{$v['verify']}"{/if} placeholder="请填写{$v['title']}">
                        </div>
                        <div class="layui-form-mid layui-word-aux">{$v['tips']|raw}</div>
                    </div>
            {/switch}
        {/volist}
        <div class="layui-form-item">
            <div class="hisi-footer">
                <div class="layui-input-block">
                    <input type="hidden" class="field-code" name="code" value="{$data['code']}">
                    <button type="submit" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="formSubmit">提交</button>
                    <a href="{:url('index')}" class="layui-btn layui-btn-primary ml10">返回</a>
                </div>
            </div>
        </div>
    </form>
    {include file="system@block/layui" /}
    <script>
    layui.use(['jquery', 'form', 'upload'], function() {
        var $ = layui.jquery, form = layui.form, upload = layui.upload, layer = layui.layer;
    
        upload.render({
            elem: '.layui-upload',
            url: '{:url("upload")}'
            ,method: 'post'
            ,before: function(input) {
                layer.msg('文件上传中...', {time:3000000});
            },done: function(res, index, upload) {
                var obj = this.item;
                if (res.code == 0) {
                    layer.msg(res.msg);
                    return false;
                }
                layer.closeAll();
                var input = $(obj).parents('.upload').find('.upload-input');
                if ($(obj).attr('lay-type') == 'image') {
                    input.siblings('img').attr('src', res.data.file).show();
                }
                input.val(res.data.file).siblings('button').text('上传成功');
            }
        });
    });
    </script>